<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<html>
<head>
	<title>区域管理</title>
		<script>
			$(document).ready(function() {
				//聚焦第一个输入框
				$("#area_groupName").focus();
				//为inputForm注册validate函数
				$("#inputForm").validate();
			});
		</script>
	</head>

<body>
	<form id="inputForm" action="${ctx}/area/${action}" method="post" class="form-horizontal">
		<input type="hidden" name="id" value="${area.id}"/>
		<fieldset>
			<legend><small>管理区域</small></legend>
			<div class="control-group">
				<label for="area_areaName" class="control-label">区域名:</label>
				<div class="controls">
					<input type="text" id="area_areaName" name="areaName"  value="${area.areaName}" class="input-large required" minlength="1"/>
				</div>
			</div>
			<%-- <div class="control-group">
				<label for="area_areagroupId" class="control-label">所属网点:</label>
				<div class="controls">
					<select id="area_areagroupId" name="areagroupId" >
						<c:forEach items="${areaGroups}" var="areaGroup">
							<option value="${areaGroup.id}" <c:if test="${not empty area.areaGroup and area.areaGroup.id eq areaGroup.id}">selected="selected"</c:if>>${areaGroup.groupName}</option>
						</c:forEach>
					</select>
				</div>
			</div> --%>
			<div class="control-group">
				<label for="area_areaType" class="control-label">区域类型:</label>
				<div class="controls">
					<select id="area_areaType" name="areaType">
						<option value="1" <c:if test="${area.areaType eq '1'}">selected="selected"</c:if>>国家</option>
						<option value="2" <c:if test="${area.areaType eq '2'}">selected="selected"</c:if>>省/自治区/直辖市</option>
						<option value="3" <c:if test="${area.areaType eq '3'}">selected="selected"</c:if>>城市/地级市</option>
						<option value="4" <c:if test="${area.areaType eq '4'}">selected="selected"</c:if>>县/县级市/区</option>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label for="area_areaCode" class="control-label">区域代码:</label>
				<div class="controls">
					<input type="text" id="area_areaCode" name="areaCode"  value="${area.areaCode}" class="input-large required" minlength="1"/>
				</div>
			</div>	
			<div class="control-group">
				<label for="area_zipCode" class="control-label">邮政编码:</label>
				<div class="controls">
					<input type="text" id="area_zipCode" name="zipCode"  value="${area.zipCode}" class="input-large required" minlength="1"/>
				</div>
			</div>
			<%-- <div class="control-group">
				<label for="area_parentId" class="control-label">所属父区域:</label>
				<div class="controls">
					<input type="text" id="area_parentId" name="parentId"  value="${area.zipCode}" class="input-large required" minlength="1"/>
				</div>
			</div> --%>
			<div class="control-group">
				<label for="area_parentId" class="control-label">所属父区域:</label>
				<div class="controls">
					<select id="area_parentId" name="parentId">
						<c:forEach items="${areas}" var="maps">
							<c:forEach items="${maps}" var="map">
								<option value="${map.key}" <c:if test = "${map.key eq area.area.id}">selected="selected"</c:if>>${map.value}</option>
							</c:forEach>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="control-group">
				<label for="status" class="control-label">状态:</label>
				<div class="controls">
					<select id="status" name="status">
						<option value="1" <c:if test="${area.status eq '1'}">selected="selected"</c:if>>有效</option>
						<option value="0" <c:if test="${area.status eq '0'}">selected="selected"</c:if>>无效</option>
					</select>
				</div>
			</div>
			<div class="form-actions">
				<input id="submit_btn" class="btn btn-primary" type="submit" value="提交"/>&nbsp;	
				<input id="cancel_btn" class="btn" type="button" value="返回" onclick="history.back()"/>
			</div>
		</fieldset>
	</form>
</body>
</html>
